/*
 * EchoServer.cpp
 *
 *  Created on: Sep 29, 2012
 *      Author: nam20485
 */

#include "EchoServer.h"
#include "Logger.h"

EchoServer::EchoServer()
{
}

EchoServer::~EchoServer()
{
}

IServer::RESPONSE EchoServer::HandleMessage(const Message& message, Connection::ID connection /* = 0*/)
{
	Logger::log("[EchoServer::Serve(");
	Logger::log(connection);
	Logger::log(") - enter]\n\r");

	RESPONSE sent = Send(message, connection);
	if (sent == SUCCESS)
	{
		Logger::log("[EchoServer::Serve(");
		Logger::log(connection);
		Logger::log(") - message sent back]\n\r");
	}
	else
	{
		Logger::log("[EchoServer::Serve(");
		Logger::log(connection);
		Logger::log(") - message NOT sent back]\n\r");
		sent = SEND_FAILED;
	}

	Logger::log("[EchoServer::Serve(");
	Logger::log(connection);
	Logger::log(") - exit]\n\r");

	return sent;
}
